package hotelManagement.hotelArtifacts;

import java.util.*;
import org.springframework.orm.hibernate3.support.*;

public class TransactionInfoDaoImpl extends HibernateDaoSupport implements TransactionInfoDao{
	
	public void save(TransactionInfo transactionInfo){
		getHibernateTemplate().save(transactionInfo);
	}
	
	public void update(TransactionInfo transactionInfo){
		getHibernateTemplate().update(transactionInfo);
	}
	
	public void delete(TransactionInfo transactionInfo){
		getHibernateTemplate().delete(transactionInfo);
	}
	
	public List<TransactionInfo> getByPersonId(String personId){
		List<TransactionInfo> ti = getHibernateTemplate().find("from TransactionInfo t where t.personId=" + personId);
		return ti;
	}
	
	public List<TransactionInfo> getByCheckOutTime(String checkOutTime){
		List<TransactionInfo> ti = getHibernateTemplate().find("from TransactionInfo as t where t.checkOutTime='" + checkOutTime + "'");
		return ti;
	}
	
	public List<TransactionInfo> getAll(){
		List<TransactionInfo> ti = getHibernateTemplate().find("from TransactionInfo");
		return ti;
	}
	
	public int getSize(){
		return getHibernateTemplate().find("from TransactionInfo").size();
	}
}
